<template>
  <div>
		<van-nav-bar  title="我的订单" left-arrow @click-left="$utils.back($route.path)" />
		<van-tabs v-model:active="active"  @change="tabChange" >
			<van-tab :title="item.title" v-for="(item,index) in tabs" :key="index">
				<div v-for="(item,index) in list" :key="index">
					<mealOrder :info="item"></mealOrder>
				</div>
			</van-tab>			
		</van-tabs>
  </div>
</template>

<script>
import mealOrder from 'components/mealOrder'
import { GetCashierDetailBySn } from 'api/order'
import { GoldplanJs } from 'utils/url.js'
import { CellGroup } from 'vant'
export default {
  components: {
    mealOrder
  },
  props: {
  },
  data() {
    return {
			tabs:[
				{
					title:'全部',
					status:0,
				},
				{
					title:'待付款',
					status:1,
				},
				{
					title:'已完成',
					status:2,
				},
				{
					title:'已取消',
					status:3,
				},
			],
			active:0,
			state:0, // 0 全部
			list:[
				{
					id:1,
					shopName:' 小二上新（泉秀店）',
					DetailList:[
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
					],
					status:1, // 待付款
					AddTime:'2022-12-26 12:34',
					PriceSum:288.325
				},
				{
					id:2,
					shopName:' 小二上新（泉秀店）',
					DetailList:[
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
						{
							Amount: 1,
							Price:10,
							ProductId: 181121,
							ProductImage: "https://img0.baidu.com/it/u=592190821,604013189&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
						},
					],
					status:2, // 已完成
					AddTime:'2022-12-26 12:34',
					PriceSum:288.325
				},
			]
    }
  },
  computed: {

  },
  watch: {

  },
  created() {

  },
  mounted() {
    
  },
  activated() {},
  methods: {
		tabChange(e){
			console.log('e',e)
			this.state = e
		},
		goOrder(){

		},
		goPay(){

		},
		goHome(){
			this.$router.push(`orderMeal/222`)
		},
    GetCashierDetailBySn() {
      const _this = this
      GetCashierDetailBySn(_this.Sn).then(res => {
        if (res) {
          var _data = res.Data
          if (_data.Sn) {
            _data.Sn = _data.Sn.substr(_data.Sn.length - 4)
          }
          _this.orderInfo = _data
        }
      })
    },
    openUserCard() {
      console.log(this.$LocalDomain)
      const url = this.$LocalDomain + '/m/home/union?pm=123&storeId=' + this.orderInfo.StoreId
      console.log(document.referrer)
      if (document.referrer.indexOf('https://payapp.weixin.qq.com/') !== -1) {
        parent.postMessage(JSON.stringify({
          action: 'jumpOut',
          jumpOutUrl: url
        }), 'https://payapp.weixin.qq.com')
      } else {
        window.location.href = url
      }
    }
  }
}
</script>

<style lang="scss" scoped>


</style>
